﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmProducto.aspx.cs" Inherits="Presentacion.frmProducto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource1" 
        DefaultMode="Insert" oniteminserted="FormView1_ItemInserted" 
        onitemupdated="FormView1_ItemUpdated">
        <EditItemTemplate>
            Id:
            <asp:TextBox ID="IdTextBox" runat="server" Enabled="False" 
                Text='<%# Bind("Id") %>' />
            <br />
            Descripcion:
            <asp:TextBox ID="DescripcionTextBox" runat="server" 
                Text='<%# Bind("Descripcion") %>' />
            <asp:RequiredFieldValidator ID="rfvDescripcion" runat="server" 
                ControlToValidate="DescripcionTextBox" 
                ErrorMessage="Debe ingresar una descripción">*</asp:RequiredFieldValidator>
            <br />
            Precio:
            <asp:TextBox ID="PrecioTextBox" runat="server" Text='<%# Bind("Precio") %>' />
            <asp:RequiredFieldValidator ID="rfvPrecio" runat="server" 
                ControlToValidate="PrecioTextBox" ErrorMessage="Debe ingresar un precio">*</asp:RequiredFieldValidator>
            <br />
            Stock:
            <asp:TextBox ID="StockTextBox" runat="server" Text='<%# Bind("Stock") %>' />
            <asp:RequiredFieldValidator ID="rfvStock" runat="server" 
                ControlToValidate="StockTextBox" ErrorMessage="Debe ingresar stock">*</asp:RequiredFieldValidator>
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Actualizar" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
        </EditItemTemplate>
        <InsertItemTemplate>
            Id:
            <asp:TextBox ID="IdTextBox" runat="server" Enabled="False" Text="0" />
            <br />
            Descripcion:
            <asp:TextBox ID="DescripcionTextBox" runat="server" 
                Text='<%# Bind("Descripcion") %>' />
            <asp:RequiredFieldValidator ID="rfvDescripcion" runat="server" 
                ControlToValidate="DescripcionTextBox" 
                ErrorMessage="Debe ingresar una descripción">*</asp:RequiredFieldValidator>
            <br />
            Precio:
            <asp:TextBox ID="PrecioTextBox" runat="server" Text='<%# Bind("Precio") %>' />
            <asp:RequiredFieldValidator ID="rfvPrecio" runat="server" 
                ControlToValidate="PrecioTextBox" ErrorMessage="Debe ingresar un precio">*</asp:RequiredFieldValidator>
            <br />
            Stock:
            <asp:TextBox ID="StockTextBox" runat="server" Text='<%# Bind("Stock") %>' />
            <asp:RequiredFieldValidator ID="rfvStock" runat="server" 
                ControlToValidate="StockTextBox" ErrorMessage="Debe ingresar stock">*</asp:RequiredFieldValidator>
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insertar" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
        </InsertItemTemplate>
        <ItemTemplate>
            Id:
            <asp:Label ID="IdLabel" runat="server" Text='<%# Bind("Id") %>' />
            <br />
            Descripcion:
            <asp:Label ID="DescripcionLabel" runat="server" 
                Text='<%# Bind("Descripcion") %>' />
            <br />
            Precio:
            <asp:Label ID="PrecioLabel" runat="server" Text='<%# Bind("Precio") %>' />
            <br />
            Stock:
            <asp:Label ID="StockLabel" runat="server" Text='<%# Bind("Stock") %>' />
            <br />

            NombreCompleto:
            <asp:Label ID="NombreCompletoLabel" runat="server" 
                Text='<%# Bind("NombreCompleto") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Editar" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Nuevo" />
        </ItemTemplate>
    </asp:FormView>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
        DataObjectTypeName="DOMINIO.Producto" DeleteMethod="DeleteProducto"
        InsertMethod="Guardar" SelectMethod="BuscarProductoPorCodigo" 
        TypeName="BL.ProductoBL" UpdateMethod="Guardar">

        <DeleteParameters>
            <asp:QueryStringParameter Name="codigo" QueryStringField="IdProd"  Type="Int32" /> 
        </DeleteParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="codigo" QueryStringField="IdProd" 
                Type="Int32" />
        </SelectParameters>
         </asp:ObjectDataSource>
    <asp:ValidationSummary ID="vsErrores" runat="server" />
    <br />
    </asp:Content>

